package com.huang.tiger.utils;

import cn.hutool.core.util.RandomUtil;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class RandomUtils {

    private static final String [] CAPITAL = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
    private static final String [] LOWERCASE = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};


    public static Integer randomInt(){
        return RandomUtil.randomInt();
    }

    public static Integer randomInt(Integer length){
        return RandomUtil.randomInt(length);
    }

    /**
     * 打乱
     * @param sourceStr
     * @return
     */
    public static String disrupt(String sourceStr){
        char[] sourceCharArray = sourceStr.toCharArray();
        List<String> sourceStrList = new ArrayList<>();
        for(Character sourceChar:sourceCharArray){
            sourceStrList.add(sourceChar+"");
        }
        Collections.shuffle(sourceStrList);
        String returnStr = "";
        for(String sourceChar:sourceStrList){
            returnStr+=sourceChar;
        }
        return returnStr;
    }


}
